package com.visitcqut.service.impl;

import com.visitcqut.domain.Reservation;
import com.visitcqut.mapper.ReservationMapper;
import com.visitcqut.service.ReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;



/**
 * @program: visitcqut
 * @description: 预约服务实现类
 * @author: ATAO
 * @create: 2020-11-14 13:37
 **/

@Repository
public class ReservationServiceImpl implements ReservationService {


    /**
     * 数据库访问层
     */
    @Autowired
    ReservationMapper reservationMapper;


    /**
     * 添加预约
     * @param data
     * @return int
     */
    @Override
    public int insert(Reservation data) {
        return reservationMapper.insert(data);
    }


    /**
     * 删除预约
     * @param id
     * @return int
     */
    @Override
    public int delete(Integer id) {
        return reservationMapper.delete(id);
    }


    /**
     * 更新预约
     * @param data
     * @return int
     */
    @Override
    public int update(Reservation data) {
        return reservationMapper.update(data);
    }


    /**
     * 根据ｉｄ查找预约
     * @param id
     * @return Reservation
     */
    @Override
    public Reservation findById(Integer id) {
        return reservationMapper.findById(id);
    }


    /**
     * 查找所有预约
     * @return :list<Reservation>
     */
    @Override
    public List<Reservation> findAll() {
        return reservationMapper.findAll();
    }
}
